package com.rc.saas.tenant.service.hlht;

import com.rc.saas.tenant.mapper.hlht.HlhtTenantOpenGunMapper;
import com.rc.saas.tenant.model.elec.ElecGun;
import com.rc.saas.tenant.model.hlht.HlhtTenantOpen;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author wangzhengwei
 * @create 2021/8/12
 */
@Service
public class HlhtTenantOpenGunServiceImpl implements HlhtTenantOpenGunService {

    @Autowired
    private HlhtTenantOpenGunMapper hlhtTenantOpenGunMapper;

    @Override
    public HlhtTenantOpenGunMapper getMapper() {
        return hlhtTenantOpenGunMapper;
    }

    @Override
    public void insertBatchByElecGunList(HlhtTenantOpen hlhtTenantOpen, List<ElecGun> elecGunList,String hlhtOpenforType, String loginName) {
        //先删除旧的依赖关系
        hlhtTenantOpenGunMapper.deleteBatchByElecGunList(hlhtTenantOpen,elecGunList,hlhtOpenforType);
        //新增新依赖关系
        hlhtTenantOpenGunMapper.insertBatchByElecGunList(hlhtTenantOpen, elecGunList,hlhtOpenforType, loginName);
    }

    @Override
    public void deleteBatchByElecStationIdList(HlhtTenantOpen hlhtTenantOpen, List<Long> ElecStationIdList) {
        hlhtTenantOpenGunMapper.deleteBatchByElecStationIdList(hlhtTenantOpen,ElecStationIdList);
    }

    @Override
    public void updateGunHlhtOpenforTypeBatchByOpenStationIdList(HlhtTenantOpen hlhtTenantOpen, List<Long> openedStationIdList, String hlhtOpenforType) {
        hlhtTenantOpenGunMapper.updateGunHlhtOpenforTypeBatchByOpenStationIdList(hlhtTenantOpen, openedStationIdList, hlhtOpenforType);
    }

    @Override
    public void deleteBatchByElecPileIdList(HlhtTenantOpen hlhtTenantOpen, List<Long> elecPileIdList) {
        hlhtTenantOpenGunMapper.deleteBatchByElecPileIdList(hlhtTenantOpen, elecPileIdList);
    }

    @Override
    public void updateGunHlhtOpenforTypeBatchByOpePileIdList(HlhtTenantOpen hlhtTenantOpen, List<Long> openedPileIdList, String hlhtOpenforType) {
        hlhtTenantOpenGunMapper.updateGunHlhtOpenforTypeBatchByOpePileIdList(hlhtTenantOpen, openedPileIdList, hlhtOpenforType);
    }

}
